"""
author: yzh
date: 2021/1/19
"""
import re
import requests

tokenList = ["", ""]


def token():
    headers = {
            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3775.400 QQBrowser/10.6.4208.400"
        }
    req = requests.get("https://webvpn.ecut.edu.cn/users/sign_in", headers=headers)
    tokenList[0] = re.findall(r'name="csrf-token" content="(.*?)"', req.text)[0]
    tokenList[1] = req.headers['set-cookie']

    return tokenList

